package jhlee42;

import java.util.Scanner;


public class J16Ch05Calculator {
	public static void main(String[] args) {
		
		// New 연산자를 이용한 객체생성은 최대한 천천히 실행 할것!
//		J16Cal cal = null;
//		cal = new J16Cal();
		
		J16Cal cal = new J16Cal();
		J16CalService cs = new J16CalService();
		
		int num_1;
		int num_2;
		String asmd;

		String msg = "두 정수와 연산자를 입력하세요..";
		System.out.println(msg);
		Scanner sc = new Scanner(System.in);
		num_1 = sc.nextInt();
		num_2 = sc.nextInt();
		asmd = sc.next();

		
		//J16Cal cal = null;
		
		switch (asmd) {
		case "+":
			cal.J16Cal(num_1, num_2);
			break;

		case "-":
			cal.J16Cal(num_1, num_2);
			break;
		case "*":
			cal = new J16Mul();
			cal.J16Cal(num_1, num_2);

			break;
		case "/":
			cal.J16Cal(num_1, num_2);
			break;
			
			
			
		}
	} // main
} // class


class J16Cal{
	private int Num_1;
	private int Num_2;

	//생성자
	public void J16Cal(int Num_1, int Num_2){
		this.Num_1=Num_1;
		this.Num_2=Num_2;
	}
	public int getNum_1() {
		return Num_1;
	}
	public void setNum_1(int num_1) {
		Num_1 = num_1;
	}
	public int getNum_2() {
		return Num_2;
	}
	public void setNum_2(int num_2) {
		Num_2 = num_2;
	}

	@Override
	public String toString() {
		String result = "";
		result += Num_1+"/"+Num_2;			
		return result;
	}
}


class J16Add extends J16Cal {}
class J16Sub extends J16Cal {}
class J16Mul extends J16Cal {}
class J16Div extends J16Cal {}


interface J16CalIService{

	void calculate(J16Cal cal, String asmd);
}
	
class J16CalService  implements J16CalIService{
		@Override
		public void calculate(J16Cal cal , String asmd ) {
			int result;
			switch (asmd) {
			case "+":
				result = cal.getNum_1() + cal.getNum_2();
				break;
			case "-":
				result = cal.getNum_1() - cal.getNum_2();
				break;
			case "*":
				result = cal.getNum_1() * cal.getNum_2();
				break;
			case "/":
				result = cal.getNum_1() / cal.getNum_2();
				break;
		}
			
		System.out.println(cal.toString());	
	}	
}





